package dimensional.traveler.client.mvc;

import dimensional.traveler.client.Mediator;
import dimensional.traveler.client.ui.util.LoadingBar;
import dimensional.traveler.client.ui.util.MessagePopup;


public abstract class MediatedController {

	protected Mediator mediator;

	public Mediator getMediator() {
		return mediator;
	}

	public void setMediator(Mediator mediator) {
		this.mediator = mediator;
	}
	
	protected void handleRequestFailure(Throwable caught) {
		LoadingBar.hideLoadingBar();
		MessagePopup.displayServerError(caught);
		if (mediator != null)
			mediator.displayLoginScreen();
	}

}
